package com.plentitude.easytrader.ui;

import com.plentitude.easytrader.R;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.Window;


/**
 * User should accept EULA on first application invocation.
 * 
 * @author team@getstarted.com.ua
 */
public class LicenseActivity extends Activity {
	
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.activity_license);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title);
    }

    @Override
    public void onBackPressed() {
    	return;
    }
    
    /** Handle "agree" action. */
    public void onAgree(View v) {
        SharedPreferences.Editor editor = getSharedPreferences(Keys.KEY, 0).edit();
    	editor.putBoolean(Keys.FIRST_RUN, false);
    	editor.commit();

    	// Start settings activity
    	final Intent intent = new Intent(LicenseActivity.this, SettingsActivity.class);
    	intent.putExtra(Keys.FIRST_RUN, true);
        startActivity(intent);
        
        finish();
    }
    
    /** Handle "finish" action. */
    public void onFinish(View v) {
        finish();
    }

	@Override
    protected void onDestroy() {
    	super.onDestroy();
    }
    
}
